//
// Created by cy on 22-5-16.
//

#ifndef CEC_VISION_EXCEPT_HPP
#define CEC_VISION_EXCEPT_HPP

#include "all.hpp"
#include "stacktrace.hpp"

class CecException : std::exception {

public:
    CecException(const std::string &error);

    CecException(const std::exception &except);

    ~CecException() noexcept override;

    char const *what() const noexcept override;

    void printStackTrace();

    static int registerException() noexcept;

private:
    char *m_error;
    std::string m_data;

    static void abrtCallBackHandel(int sig_num);

    static void segvCallBackHandel(int sig_num);

};

[[maybe_unused]] static int REG_EXCEPT_ = CecException::registerException();

#endif //CEC_VISION_EXCEPT_HPP
